package com.spsy.order.controller;
import com.alibaba.fastjson2.JSON;
import com.spsy.api.common.AddOrderVo;
import com.spsy.common.core.domain.R;
import com.spsy.pay.api.PayApi;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;



@RestController
@RequestMapping("/order")
@Slf4j
public class OrderApiController {
    @Autowired
    private PayApi payApi;

    @PostMapping(value = "/create",consumes = MediaType.APPLICATION_JSON_VALUE)
    public R createOrder(@RequestBody AddOrderVo addOrderVo) throws Exception{
        log.info("订单系统-参数：addOrderVo：{}", JSON.toJSONString(addOrderVo));
        R r = payApi.createOrder(addOrderVo);
        return r;
    }
}
